# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=apx
pkgver=2.4.0
pkgrel=2
pkgdesc="A package manager that can install packages from multiple sources without altering the root filesystem"
url="https://github.com/Vanilla-OS/apx"
license="GPL-3.0-only"
# s390x, riscv64, armv7, armhf and x86 blocked by podman -> distrobox
arch="x86_64 aarch64 ppc64le"
depends="distrobox"
makedepends="go"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/Vanilla-OS/apx/archive/refs/tags/v$pkgver.tar.gz
	config.json
	"
# net required to download go modules
# no tests
options="net !check"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	go build -trimpath -v -o apx
}

package() {
	install -Dm755 apx "$pkgdir"/usr/bin/apx
	install -Dm644 "$srcdir"/config.json "$pkgdir"/usr/share/apx/config.json

	install -Dm755 man/man1/apx.1 "$pkgdir"/usr/share/man/man1/apx.1
}

sha512sums="
5e220c911894f7f54084966078495abadb424778f1a86fa767da8adba0d8e90e317a54ec86b22f1948f4123f7f0d817d6bd1c25a15af21f794c10b8945ce5c80  apx-2.4.0.tar.gz
0d0e999b5b2e714bcd63e69357740a805cf3670c2e9d03c36700de17aec0445e56cb1da27b1b192fe11287beb98833d616fcc51937872b845bdb693ea9901929  config.json
"
